home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / perl5 / UNIVERSAL.z / UNIVERSAL
Encoding:
Text File  |  1998-10-30  |  2.9 KB  |  133 lines

  1.  
  2.  
  3.  
  4. UUUUNNNNIIIIVVVVEEEERRRRSSSSAAAALLLL((((3333))))                                                      UUUUNNNNIIIIVVVVEEEERRRRSSSSAAAALLLL((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      UNIVERSAL - base class for ALL classes (blessed references)
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.          $io = $fd->isa("IO::Handle");
  13.          $sub = $obj->can('print');
  14.  
  15.          $yes = UNIVERSAL::isa($ref, "HASH");
  16.  
  17.  
  18. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      UNIVERSAL is the base class which all bless references will inherit from,
  20.      see the _p_e_r_l_o_b_j manpage
  21.  
  22.      UNIVERSAL provides the following methods
  23.  
  24.      isa ( TYPE )
  25.          isa returns _t_r_u_e if REF is blessed into package TYPE or inherits from
  26.          package TYPE.
  27.  
  28.          isa can be called as either a static or object method call.
  29.  
  30.      can ( METHOD )
  31.          can checks if the object has a method called METHOD. If it does then
  32.          a reference to the sub is returned. If it does not then _u_n_d_e_f is
  33.          returned.
  34.  
  35.          can can be called as either a static or object method call.
  36.  
  37.      VERSION ( [ REQUIRE ] )
  38.          VERSION will return the value of the variable $VERSION in the package
  39.          the object is blessed into. If REQUIRE is given then it will do a
  40.          comparison and die if the package version is not greater than or
  41.          equal to REQUIRE.
  42.  
  43.          VERSION can be called as either a static or object method call.
  44.  
  45.      The isa and can methods can also be called as subroutines
  46.  
  47.      UNIVERSAL::isa ( VAL, TYPE )
  48.          isa returns _t_r_u_e if the first argument is a reference and either of
  49.          the following statements is true.
  50.  
  51.                  VAL is a blessed reference and is blessed into package TYPE
  52.                  or inherits from package TYPE
  53.  
  54.                  VAL is a reference to a TYPE of perl variable (er 'HASH')
  55.  
  56.      UNIVERSAL::can ( VAL, METHOD )
  57.          If VAL is a blessed reference which has a method called METHOD, can
  58.          returns a reference to the subroutine.   If VAL is not a blessed
  59.          reference, or if it does not have a method METHOD, _u_n_d_e_f is returned.
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. UUUUNNNNIIIIVVVVEEEERRRRSSSSAAAALLLL((((3333))))                                                      UUUUNNNNIIIIVVVVEEEERRRRSSSSAAAALLLL((((3333))))
  71.  
  72.  
  73.  
  74.      These subroutines should _n_o_t be imported via use UNIVERSAL qw(...).  If
  75.      you want simple local access to them you can do
  76.  
  77.        *isa = \&UNIVERSAL::isa;
  78.  
  79.      to import isa into your package.
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.